package com.title6;

import java.io.*;
import java.util.HashMap;
import java.util.HashSet;

/**
 * @Author milian
 * @Date 2021/8/4 0004 21:47
 */
public class title6 {
    public static void main(String[] args) throws IOException {
        InputStreamReader isr = new InputStreamReader(new FileInputStream("H:\\homework\\day13\\src\\com\\title6\\a.txt"));
        StringBuilder sb = new StringBuilder("");
        int len;
        char[] chars = new char[1024];
        while((len=isr.read(chars))!=-1){
            sb.append(new String(chars,0,len));
        }
        isr.close();
        String[] split = sb.toString().split("\r\n");
        HashMap<Integer, String> map = new HashMap<>();
        for (String s : split) {
            int key = Integer.parseInt(s.substring(0,1));
            map.put(key,s);
        }
        BufferedWriter bw = new BufferedWriter(new FileWriter("H:\\homework\\day13\\src\\com\\title6\\b.txt"));
        for (int i=1;i<=split.length;i++){
            bw.write(map.get(i));
            bw.newLine();
        }
        bw.close();
    }


}
